<?php
/**	
 * This file defines the various loops for use
 * throughout the theme. The default loop is sufficient
 * for nearly every circumstance because it is PACKED
 * with a myriad of action hooks you can use.
 *
 * @author Nathan Rice
 * @package Prodigy
 */

//	/////////////////////////////////////////////
//	The default loop to use throughout the theme
//	/////////////////////////////////////////////
function prodigy_loop_default() { ?>
	<?php prodigy_before_loop(); ?>
	<?php if (have_posts()) : while (have_posts()) : the_post(); // the loop ?>
			
		<?php prodigy_before_post(); ?>
		
			<?php 
			prodigy_before_post_title();
			prodigy_post_title(); // post title, filterable
			prodigy_after_post_title(); 
			?>
			
			<?php
			prodigy_before_post_content();
			the_content(); //post text with the filterable read more link
			prodigy_after_post_content();
			?>

		<?php prodigy_after_post(); ?>
		
		<?php endwhile; // end of one post ?>
		<?php prodigy_after_endwhile(); ?>
		<?php else : // do not delete ?>
		<?php prodigy_loop_else(); ?>
	
	<?php endif; // do not delete ?>
	<?php prodigy_after_loop(); ?>
<?php 
}

//	/////////////////////////////////////////////
//	The loop we use on blog index page templates
//	/////////////////////////////////////////////
function prodigy_loop_blog_page() { ?>
	<?php prodigy_before_loop(); ?>
	<?php $numposts = get_option('posts_per_page'); ?>
	<?php $wp_query = new WP_Query('showposts='.$numposts.'&paged='.$paged); ?>
	<?php if($wp_query->have_posts()) : while($wp_query->have_posts()) : $wp_query->the_post(); ?>
			
		<?php prodigy_before_post(); ?>
		
			<?php 
			prodigy_before_post_title();
			prodigy_post_title(); // post title, filterable
			prodigy_after_post_title(); 
			?>
		
			<?php
			prodigy_before_post_content();
			the_content(); //post text with the filterable read more link
			prodigy_after_post_content();
			?>
	    
	    <?php prodigy_after_post(); ?>
		
		<?php endwhile; // end of one post ?>
		<?php prodigy_after_endwhile(); ?>
		<?php else : // do not delete ?>
		<?php prodigy_loop_else(); ?>
	
	<?php endif; // do not delete ?>
	<?php prodigy_after_loop(); ?>
<?php
}

//	/////////////////////////////////////////////
//	The loop we use when content can't be found
//	/////////////////////////////////////////////
function prodigy_loop_404() { ?>
	<?php prodigy_before_loop(); ?>
	<h3><?php _e("Page Not Found","prodigy"); ?></h3>
    <p><?php _e("We're sorry, but the page you are looking for isn't here.","prodigy"); ?></p>
    <p><?php _e("Try searching for the page you are looking for or using the navigation in the header or sidebar","prodigy"); ?></p>
    <?php prodigy_after_loop(); ?>
<?php } 

?>